<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/vue.js"></script>
    <style>
        h1{margin-top: 20px;}
    </style>
</head>
<body>
    <div id="root">
        <h1>遍历数组</h1>
        <ul>
            <li v-for="(p, index) in peoples" :key="index">
                name:{{p.name}}, age:{{p.age}}
            </li>
        </ul>

        <h1>遍历对象</h1>
        <ul>
            <li v-for="(value, key) in obj">
                {{key}}: {{value}}
            </li>
        </ul>

        <h1>遍历字符串</h1>
        <ul>
            <li v-for="(char, index) in arr" :key="index">
                {{index}}:  {{char}}
            </li>
        </ul>
    </div>
    <script>
        Vue.config.productionTip = false;
        let vm = new Vue({
            el: '#root',
            data: {
                peoples:[
                    {id:001, name:'张三', age:17},
                    {id:002, name:'李四', age:19},
                    {id:003, name:'王五', age:21},
                ],
                obj:{
                    car:'奥迪',
                    type:'A888',
                    master:'刘爱国'
                },
                arr:'hello',
            },
        });
    </script>
</body>
</html>